import matplotlib.pyplot as plt
import numpy as np

# 生成100个随机数作为accuracy
x_data = np.linspace(0, 100, 45)
y_data = np.linspace(1,0.1,1000)
# 训练集和测试集准确率
train_accuracy = [0.6, 0.7, 0.75, 0.8, 0.85, 0.9, 0.92, 0.94, 0.95, 0.96, 0.97, 0.98, 0.98, 0.99, 0.99, 0.99, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]

test_accuracy = [0.5, 0.6, 0.65, 0.7, 0.75, 0.8, 0.83, 0.86, 0.87, 0.88, 0.89, 0.9, 0.9, 0.91, 0.91, 0.91, 0.92, 0.92, 0.93, 0.93, 0.93, 0.94, 0.94, 0.94, 0.94, 0.94, 0.94, 0.94, 0.94, 0.94, 0.94, 0.94, 0.94, 0.94, 0.94, 0.94, 0.94, 0.94, 0.94, 0.94, 0.94, 0.94, 0.94, 0.94, 0.94]

# 训练集和测试集损失
train_loss = [1.2, 1, 0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1, 0.05, 0.03, 0.02, 0.01, 0.005, 0.003, 0.002, 0.001, 0.0005, 0.0003, 0.0002, 0.0001, 0.00005, 0.00003, 0.00002, 0.00001, 0.000005, 0.000003, 0.000002, 0.000001, 0.0000005, 0.0000003, 0.0000002, 0.0000001, 0.00000005, 0.00000003, 0.00000002, 0.00000001, 0.000000005, 0.000000003, 0.000000002, 0.000000001, 0.0000000005, 0]

test_loss = [1.3, 1.1, 1, 0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.15, 0.1, 0.07, 0.05, 0.03, 0.02, 0.015, 0.01, 0.008, 0.006, 0.005, 0.004, 0.003, 0.002, 0.0015, 0.001, 0.0008, 0.0006, 0.0005, 0.0004, 0.0003, 0.0002, 0.00015, 0.0001, 0.00008, 0.00006, 0.00005, 0.00004, 0.00003, 0.00002, 0.000015, 0.00001, 0.000008, 0.000006, 0.000005, 0.000004, 0.000003, 0.0000025, 0.000002, 0.0000018, 0.0000015, 0.0000013, 0.0000012, 0.000001, 0.0000008]
print(len(train_loss))
print(len(test_loss))
print(len(test_accuracy))
print(len(train_accuracy))
# 画图
plt.figure(figsize=(8, 6))
plt.plot(x_data, train_loss[:45], 'r-', label='Train')
plt.plot(x_data, test_loss[:45], 'b-', label='Test')
plt.title('Accuracy and Loss')
plt.xlabel('Accuracy')
plt.ylabel('Loss')
plt.legend()
plt.savefig('figure.png')
plt.show()
